package ru.ifmo.tanya.core.huntgroups;

import org.jdom.Element;


public class HuntGroup {

    private final int id;

    private final String name;
    private final String extension;
    public HuntGroup(int id, String name, String extension) {
        this.id = id;
        this.name = name;
        this.extension = extension;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getExtension() {
        return extension;
    }

    public Element toXml() {
        return new Element("hunt-group")
                .setAttribute("name", name)
                .setAttribute("extension", extension)
                .setAttribute("id", id + "");
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        HuntGroup huntGroup = (HuntGroup) o;

        if (!extension.equals(huntGroup.extension)) return false;
        if (!name.equals(huntGroup.name)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + extension.hashCode();
        return result;
    }
}
